package com.dcd.service.impl;

import com.dcd.mapper.Follow_car_seriesMapper;
import com.dcd.pojo.Follow_car_series;
import com.dcd.service.Follow_car_seriesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class Follow_car_seriesServiceImpl implements Follow_car_seriesService {

    @Autowired
    private Follow_car_seriesMapper follow_car_seriesMapper;

    /**
     * 关注指定车系
     *
     * @param follow_car_series 关注车系对象
     * @return
     */
    @Override
    public boolean insert_follow_car_series(Follow_car_series follow_car_series) {
        return follow_car_seriesMapper.insert_follow_car_series(follow_car_series) == 1;
    }

    /**
     * 删除指定用户关注的车系
     *
     * @param follow_car_series 关注车系对象
     * @return
     */
    @Override
    public boolean delete_follow_car_series(Follow_car_series follow_car_series) {
        return follow_car_seriesMapper.delete_follow_car_series(follow_car_series) > 0;
    }

    /**
     * 查询用户是否关注指定车系
     *
     * @param follow_car_series
     * @return
     */
    @Override
    public boolean select_user_whether_follow_car_series(Follow_car_series follow_car_series) {
        return follow_car_seriesMapper.select_user_whether_follow_car_series(follow_car_series) == 1;
    }

    /**
     * 根据用户登录的id查询所有关注的车系
     * @param user_id 登录的用户id
     * @return
     */
    @Override
    public List<Follow_car_series> select_follow_car_series(int user_id) {
        return follow_car_seriesMapper.select_follow_car_series(user_id);
    }
}
